package com.kern.academic.entity;

import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 *
 *  用户实体类
 *
 *      用户实体与角色实体的对应关系
 *      一个用户只有一个角色;
 *      一个角色对应有多个用户
 * Created by caoshi at 6:12 2021-06-26
 */
@Data
@Entity
@Table(name = "t_user")
public class XUser implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    @Column(name = "id")
    private String id;

    /**
     * 用户名
     */
    @Column(name = "username")
    private String username;

    /**
     * 登录密码
     */
    @Column(name = "password")
    private String password;

    /**
     * 角色id
     */
    @Column(name = "role_id", insertable = false, updatable = false)
    private String roleId;

    /**
     * 启用状态
     */
    @Column(name = "enable")
    private Integer enable;

    /**
     * 电话号码
     */
    @Column(name = "phone")
    private String phone;

    /**
     * 邮箱
     */
    @Column(name = "email")
    private String email;

    /**
     * 创建时间
     */
    @Column(name = "createtime")
    private Date createtime;

    /**
     * 扩展描述
     */
    @Column(name = "extend")
    private String extend;

    /**
     * 多个用户可能是同一个角色
     */
    @ManyToOne(targetEntity = XRole.class)
    private XRole role;

}
